<script setup lang="ts">
import { ref } from 'vue'
import type { TabsPaneContext } from 'element-plus'
import WifiConfig from './components/WifiConfig.vue'
import MQTT from './components/Mqtt.vue'
import DHT22 from './components/DHT22.vue'
import AP from './components/ApConfig.vue'
const activeName = ref('wifi')

const handleClick = (tab: TabsPaneContext, event: Event) => {
  console.log(tab, event)
}
</script>

<template>
  <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
    <el-tab-pane label="WIFI连接配置" name="wifi">
      <div class="tab-content"><WifiConfig /></div>
    </el-tab-pane>
    <el-tab-pane label="AP配置" name="ap">
      <div class="tab-content"><AP /></div>
    </el-tab-pane>
    <el-tab-pane label="MQTT配置" name="mqtt">
      <div class="tab-content"><MQTT /></div>
    </el-tab-pane>
    <el-tab-pane label="DHT22配置" name="dht22">
      <div class="tab-content"><DHT22 msg="大家好DHT22" /></div>
    </el-tab-pane>
  </el-tabs>
</template>

<style>
/* 内容居中 */
.tab-content {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px; /* 可根据内容调整高度 */
  font-size: 20px;
}

/* tab 标题栏居中 */
.demo-tabs .el-tabs__nav-wrap {
  display: flex;
  justify-content: center;
}

.demo-tabs > .el-tabs__content {
  padding: 32px;
  color: #6b778c;
  font-size: 32px;
  font-weight: 600;
}
</style>
